<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<script>
    var arr = [1, 2, 3, 4, 5, 6];
    // 映射
    var arr_map = arr.map((item, currentValue) => {
        return item > 3
        console.log(currentValue)
    })
    console.log(arr_map); //[false, false, false, true, true, true]

    // 过滤 筛选
    var arr_filter = arr.filter((item) => {
        return item > 3
    })
    console.log(arr_filter); //[4,5,6]

    // some和every
    // some 数组中只要有一个元素符合条件 就返回 true
    // every 数组只要有一个元素不符合条件 就返回 false
    var flag_some = arr.some((item) => {
        return item > 5
    })
    console.log(flag_some); // true

    var flag_every = arr.every((item) => {
        return item > 5
    })
    console.log(flag_every); // false
</script>
</body>

</html>
